package com.xhorse.lockplatform.service.impl;

import com.xhorse.lockplatform.dao.mapper.*;
import com.xhorse.lockplatform.model.XhKey;
import com.xhorse.lockplatform.model.XhModel;
import com.xhorse.lockplatform.model.XhUpdateInfo;
import com.xhorse.lockplatform.model.pojo.BrandInfo;
import com.xhorse.lockplatform.model.pojo.CarMake;
import com.xhorse.lockplatform.model.pojo.ResponseKeyInfo;
import com.xhorse.lockplatform.service.KeyGeneratorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: Tom
 * @Date: 2018/3/29
 * @Description:
 */
@Service
public class KeyGeneratorServiceImpl implements KeyGeneratorService {

    @Autowired
    private XhImageMapper xhImageMapper;

    @Autowired
    private XhDataMapper xhDataMapper;

    @Autowired
    private XhModelMapper xhModelMapper;

    @Autowired
    private XhBrandMapper xhBrandMapper;

    @Autowired
    private XhKeyMapper xhKeyMapper;

    @Autowired
    private KeyGenerationMapper keyGenerationMapper;

    @Override
    public List<XhUpdateInfo> selectLogByVersion(int regionId, int languageId) {
        return null;
    }

    @Override
    public void generateZipFile(String imgversion, String dbversion, String newVersion, int regionId) {

    }

    @Override
    public int findImgVersion() {
        return xhImageMapper.findMaxVersion();
    }

    @Override
    public int findDataVersion(String dbVersion, int regionId) {
        return xhDataMapper.findMaxVersion(dbVersion, regionId);
    }

    @Override
    public int findBrandVersion(String dbVersion, int languageId) {
        return xhBrandMapper.findMaxVersion(dbVersion, languageId);
    }

    @Override
    public List<BrandInfo> findBrand(String dbVersion, int languageId) {
        return xhBrandMapper.selectByParam(dbVersion, languageId);
    }

    @Override
    public List<XhModel> findModelByBrandId(XhModel xhModel) {
        return xhModelMapper.selectModelByBrandId(xhModel);
    }

    @Override
    public List<XhKey> findKeyByModelId(XhKey xhKey) {
        return xhKeyMapper.selectKeyByModeId(xhKey);
    }

    @Override
    public List<CarMake> remoteInfoGenerate(String dbversion, int languageId) {
        return keyGenerationMapper.getRemotInfo(dbversion, languageId);
    }

    @Override
    public List<ResponseKeyInfo> chipGenerate(String dbversion, int languageId) {
        return keyGenerationMapper.chipGenerate(dbversion, languageId);
    }


}
